package outerclass.local_demo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025/5/11
 * Time: 18:54
 */

public class OuterClass {
    public String publicNumber = "outer";
    public void method(){
        //局部内部类
        class LocalInnerClass {
            public final String publicNumber = "inner";
            public void method(){
                System.out.println(this.publicNumber);
                System.out.println(OuterClass.this.publicNumber);
            }
        }
        //只能在本方法内部实例化LocalInnerClass
        LocalInnerClass localInnerClass = new LocalInnerClass();
        localInnerClass.method();
    }
}
